home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / diverses / cexpress / screen / rowcolrb.asm < prev    next >
Encoding:
Assembly Source File  |  1989-05-03  |  1.3 KB  |  53 lines

  1. ;void  row_color_b(col,row,width,color);
  2. ;  unsigned char  col,row,width,color;
  3.  
  4.     EXTRN  _memory_model:byte
  5.     EXTRN  _video_page:byte
  6.  
  7. _TEXT    SEGMENT BYTE PUBLIC 'CODE'
  8.     ASSUME CS:_TEXT
  9.     PUBLIC _row_color_b
  10. _row_color_b proc near
  11.     push bp            ;
  12.     mov  bp,sp        ;set stack frame
  13.     push di            ;
  14.     cmp  _memory_model,0    ;near or far?
  15.     jle   begin        ;jump if near
  16.     inc  bp            ;else add 2 to BP
  17.     inc  bp            ;
  18. begin:    mov  bh,_video_page    ;set video page
  19.     mov  dl,[bp+4]        ;Col in DL
  20.     dec  dl            ;count from 0
  21.     mov  dh,[bp+6]        ;Row in DH
  22.     dec  dh            ;count from 0    
  23.     sub  ax,ax        ;
  24.     mov  al,[bp+8]        ;width
  25.     mov  di,ax        ;
  26.     or   di,di        ;check for 0
  27.     jz   L4            ;quit if 0
  28.     mov  bl,[bp+10]        ;new attribute
  29.     mov  cx,1        ;number chars to write
  30. L1:    mov  ah,2        ;function to set cursor
  31.     int  10h        ;set the cursor
  32.     mov  ah,8        ;func to read char/attri
  33.     int  10h        ;now AL-AH has char/attri
  34.     mov  ah,9        ;func to write char/attri
  35.     int  10h        ;write chr with new attri
  36.     cmp  dl,80        ;end of row?
  37.     jne  L2            ;jump ahead if not
  38.     mov  dl,0        ;else next col is 0
  39.     inc  dh            ;point to next row
  40.     jmp  short L3        ;jump ahead
  41. L2:    inc  dl            ;same row, next col
  42. L3:    dec  di            ;dec char counter
  43.     jnz  L1            ;loop if not finished
  44. L4:    pop  di            ;
  45.     pop  bp            ;
  46.     cmp  _memory_model,0    ;quit
  47.     jle  quit        ;
  48.     db   0CBh        ;RET far
  49. quit:    ret            ;RET near
  50. _row_color_b endp
  51. _TEXT    ENDS
  52.     END
  53.